//
// Decompiled by Jadx - 519ms
//
package r;

import android.annotation.SuppressLint;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public final class h {
    public static final Date a = new Date();

    @SuppressLint({"ConstantLocale"})
    public static final SimpleDateFormat b = new SimpleDateFormat("MM-dd", Locale.getDefault());

    @SuppressLint({"ConstantLocale"})
    public static final SimpleDateFormat c = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
    public static final a d = new a();
    public static final b e = new b();

    public static String f(long j) {
        long j2 = j / 86400;
        long j3 = j % 86400;
        long j4 = j3 / 3600;
        long j5 = j3 % 3600;
        long j6 = j5 / 60;
        long j7 = j5 % 60;
        StringBuilder sb = new StringBuilder();
        if (j2 > 0) {
            sb.append(j2);
            sb.append("天");
        }
        if (j4 > 0) {
            sb.append(j4);
            sb.append("小时");
        }
        if (j6 > 0) {
            sb.append(j6);
            sb.append("分钟");
        }
        if (j7 > 0) {
            sb.append(j7);
            sb.append("秒");
        }
        return sb.toString();
    }

    public static String g(Date date, DateFormat dateFormat) {
        return dateFormat != null ? dateFormat.format(date) : "";
    }

    public static String h(long j) {
        return String.valueOf((int) Math.ceil((((System.currentTimeMillis() - j) / 3600.0d) / 1000.0d) / 24.0d));
    }

    public static String i(long j) {
        long currentTimeMillis = System.currentTimeMillis() - j;
        if (currentTimeMillis < 1000) {
            return "刚刚";
        }
        if (currentTimeMillis < 60000) {
            return String.format(Locale.getDefault(), "%d秒前", Long.valueOf(currentTimeMillis / 1000));
        }
        if (currentTimeMillis < 3600000) {
            return String.format(Locale.getDefault(), "%d分钟前", Long.valueOf(currentTimeMillis / 60000));
        }
        long l = l();
        return j >= l ? String.format("%tR", Long.valueOf(j)) : j >= l - 0x05265c00 ? String.format("昨天%tR", Long.valueOf(j)) : j >= l - 0x0a4cb800 ? String.format("1天前%tR", Long.valueOf(j)) : j >= l - 0x0f731400 ? String.format("2天前%tR", Long.valueOf(j)) : j >= l - 0x14997000 ? String.format("3天前%tR", Long.valueOf(j)) : j >= l - 0x19bfcc00 ? String.format("4天前%tR", Long.valueOf(j)) : j >= l - 0x1ee62800 ? String.format("5天前%tR", Long.valueOf(j)) : String.format("%tF", Long.valueOf(j));
    }

    public static String j(long j) {
        long j2 = j * 1000;
        Date date = a;
        date.setTime(j2);
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(System.currentTimeMillis());
        Calendar calendar2 = Calendar.getInstance();
        calendar2.setTimeInMillis(j2);
        long currentTimeMillis = (System.currentTimeMillis() / 1000) - j;
        if (currentTimeMillis < 60) {
            return "刚刚";
        }
        if (currentTimeMillis < 3600) {
            return (currentTimeMillis / 60) + "分钟前";
        }
        if (currentTimeMillis < 86400) {
            return (currentTimeMillis / 3600) + "小时前";
        }
        if (86400 >= currentTimeMillis || currentTimeMillis >= 2592000) {
            return calendar.get(1) == calendar2.get(1) ? b.format(date) : c.format(date);
        }
        return ((currentTimeMillis / 3600) / 24) + "天前";
    }

    public static String k(long j) {
        long currentTimeMillis = System.currentTimeMillis() - j;
        return currentTimeMillis < 0 ? String.format("%tc", Long.valueOf(j)) : currentTimeMillis < 1000 ? "刚刚" : currentTimeMillis < 60000 ? String.format(Locale.getDefault(), "%d秒前", Long.valueOf(currentTimeMillis / 1000)) : currentTimeMillis < 3600000 ? String.format(Locale.getDefault(), "%d分钟前", Long.valueOf(currentTimeMillis / 60000)) : j >= l() ? String.format("%tR", Long.valueOf(j)).replace("-", "/") : String.format("%tF", Long.valueOf(j)).replace("-", "/");
    }

    public static long l() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(11, 0);
        calendar.set(13, 0);
        calendar.set(12, 0);
        calendar.set(14, 0);
        return calendar.getTimeInMillis();
    }

    public static String m(long j) {
        return g(new Date(j), (DateFormat) e.get());
    }
}
